#ifndef VIGENEREBREAKERFORM_H
#define VIGENEREBREAKERFORM_H

#include <QWidget>

namespace Ui {
class VigenereBreakerForm;
}

class VigenereBreakerForm : public QWidget
{
    Q_OBJECT
    Q_PROPERTY(bool autokeyMode READ autokeyMode WRITE setAutokeyMode NOTIFY autokeyModeChanged)
    
public:
    explicit VigenereBreakerForm(QWidget *parent = 0);
    ~VigenereBreakerForm();

    Q_INVOKABLE inline bool autokeyMode() const {return _autokey;}

public slots:
    void haveKeyLenght(int keyLenght);
    void haveKeyLenght(QList<int> correlations);
    void broken(QByteArray key, QByteArray plaintext);
    void setAutokeyMode(bool on) {if (on != _autokey) {_autokey = on; emit autokeyModeChanged(on);}}
    
private slots:

    void on_friedman_clicked(bool checked);

    void on_loadCipher_clicked();

    void on_loadFreq_clicked();

    void on_crackLenght_clicked();

    void on_break_2_clicked();

    void on_save_clicked();

    void on_decrypt_clicked();

    void on_cEscape_clicked();

    void on_URLEscape_clicked();

    void on_hex_clicked();

    void on_base64_clicked();

    void on_binaryMode_clicked(bool checked);

signals:
    void autokeyModeChanged(bool);

private:
    Ui::VigenereBreakerForm *ui;

    QByteArray alphabet;
    QList<qreal> langFrequencies;
    bool hasLoadedFreqs;

    bool _autokey;

};

#endif // VIGENEREBREAKERFORM_H
